/*=============================================================================

  APPLICATION MANAGER MODULE

  FILE: BKmgr.cpp
  
  DESCRIPTION

    Manager Module Definition

  EXTERNALIZED FUNCTIONS

    
  Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

                             EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who     what, where, why
  ---------  -------  -------------------------------------------------------
   06/28/03   nso4th   Version 0.1

=============================================================================*/

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include <BKmgr_MOD.h>

/*=============================================================================
  LOCALIZED FUNCTION DEFINITION
=============================================================================*/

/*=============================================================================
  EVENT HANDLER
=============================================================================*/
dword BKmgr::Event_Handler(dword dwType, dword dwEvent, dword wParam, dword lParam)
{	
	SYSmgr			*sm = (SYSmgr*)ObjList_Get(SYS_MGR);
	DWORD			event, eventID;
	
	if(Event_PreProc(dwType, dwEvent, wParam, lParam) == TRUE)
		return	TRUE;

	event = HDEV_GETEVENT(dwEvent);
	eventID = HDEV_GETDEV_ID(dwEvent);
	
	if(sm)
	{
		sm->HEvent_Handler(dwType, dwEvent, wParam, lParam);
	}
	
	return	TRUE;
}

dword BKmgr::HEvent_Handler(dword dwType, dword dwEvent, dword wParam, dword lParam)
{
	DWORD			event, eventID;

	event = HDEV_GETEVENT(dwEvent);
	eventID = HDEV_GETDEV_ID(dwEvent);

	return	(TRUE);
}

dword BKmgr::Event_PreProc(dword dwType, dword dwEvent, dword wParam, dword lParam)
{
	DWORD			event, eventID;

	event = HDEV_GETEVENT(dwEvent);
	eventID = HDEV_GETDEV_ID(dwEvent);
	
	// State Monitoring
	if(IS_STATE_EVENT(dwType))
	{
		if((m_monLock == FALSE) && (m_reqLock == FALSE))
		{
			MON_STATE();
		}
		return	TRUE;
	}
	
	// Block the internal event (Command, State event)
	if(IS_CMD_EVENT(dwType))
	{
		Command_Handler(dwEvent, wParam, lParam);
		return	TRUE;
	}

	return	FALSE;
}

/*=============================================================================
  LOCALIZED FUNCTION IMPLEMENTATION
=============================================================================*/


/*--- END OF BKmgr.CPP ---*/